package thread;

import java.util.Scanner;

public class ThreadDemo03 {
    static String content;
    public static void main(String[] args)  {
        Thread mainThread = Thread.currentThread();
        Thread t=new Thread(()->{
            content="abcd";
            //中断指定线程的休眠
            mainThread.interrupt();
        });
        t.start();//可运行状态(就绪状态)
        //线程休眠
        try {
            Thread.sleep(1000);//1000毫秒
        }catch (InterruptedException e){
            //e.printStackTrace();
        }
        //while(content==null);//一直占着CPU
        //content为null时，让出cpu
        //while(content==null)Thread.yield();
        //IO阻塞
        //Scanner sc=new Scanner(System.in);
        //sc.nextInt();
        System.out.println(content.toUpperCase());//ABCD
    }
}
